package uk.ac.manchester.cs.owl.ontologyrepositoryapi.tools;

import uk.ac.manchester.cs.owl.ontologyrepositoryapi.BioPortalOntologyRepository;
import uk.ac.manchester.cs.owl.ontologyrepositoryapi.OntologyRepositoryEntry;

/**
 * Author: Matthew Horridge<br>
 * The University of Manchester<br>
 * Bio-Health Informatics Group<br>
 * Date: 01/02/2011
 */
public class ListOntologies {

    public static void main(String[] args) {
    	
        BioPortalOntologyRepository repository = new BioPortalOntologyRepository(args[0]/*API key*/);
        int count = 0;
        int owlCompatibleCount = 0;
        int oboCount = 0;
        int owlCount = 0;
        for(OntologyRepositoryEntry entry : repository.getEntries()) {
            count++;
            if (entry.isOWLCompatibleFormat()) {
                System.out.println(entry);
                owlCompatibleCount++;
            }
            if(entry.getFormat().toLowerCase().contains("owl")) {
                owlCount++;
            }
            else if(entry.getFormat().toLowerCase().contains("obo")) {
                oboCount++;
            }
        }
        System.out.println("-----------------------------------------------------------------------");
        System.out.println(count + " ontologies in BioPortal");
        System.out.println(owlCompatibleCount + " OWL compatible ontologies");
        System.out.println(owlCount + " OWL ontologies");
        System.out.println(oboCount + " OBO ontologies");
    }
}
